package cn.wolfcode.luowowo.mgrsite.controller;

import cn.wolfcode.luowowo.article.domain.Travel;
import cn.wolfcode.luowowo.article.domain.TravelContent;
import cn.wolfcode.luowowo.article.service.IStrategTagService;
import cn.wolfcode.luowowo.article.service.ITravelCommendService;
import cn.wolfcode.luowowo.article.service.ITravelContentService;
import cn.wolfcode.luowowo.article.service.ITravelService;import cn.wolfcode.luowowo.common.query.QueryObject;
import cn.wolfcode.luowowo.common.query.TravelQueryObject;
import com.github.pagehelper.PageInfo;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("travel")
public class TravelController {
    @Reference
    private ITravelService travelService;
    @Reference
    private ITravelContentService travelContentService;


    @RequestMapping("list")
   public String list(@ModelAttribute("qo")TravelQueryObject qo, Model model){
        PageInfo<Travel> pageInfo = travelService.queryForList(qo);
        model.addAttribute("pageInfo",pageInfo);
        return "travel/list";
    }
    @RequestMapping("getTravelContent")
    @ResponseBody
   public Object getTravelContent(Long  id){
        TravelContent travelContent = travelContentService.selectByPrimaryKey(id);
        return travelContent;
    }

}
